<%@ page language="java" import="java.util.*,javaNews.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'news.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	



<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="css/read.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
	function checkComment(){
		var cauthor = document.getElementById("cauthor");
		var content = document.getElementById("ccontent");
		if(cauthor.value == ""){
			alert("用户名不能为空！！");
			return false;
		}else if(content.value == ""){
			alert("评论内容不能为空！！");
			return false;
		}
		return true;
	}
</script>

  </head>
  
  <body>
    
<div id="container">
  


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<div class="sidebar">
    <h1> <img src="images/title_1.gif" alt="国内新闻" /> </h1>
    <div class="side_list">
      <ul>      
       
      	      	
     	<li> <a href='news_read.jsp?nid=49'><b> 发改委：4万亿投资计划不会挤占民间投资空间</b></a> </li>      	
       
      	      	
     	<li> <a href='news_read.jsp?nid=57'><b> 河南2个乡镇政绩报告内容完全一致引关注</b></a> </li>      	
       
      	      	
     	<li> <a href='news_read.jsp?nid=70'><b> 重庆警方否认被围殴致死吸毒者曾针刺民众</b></a> </li>      	
       
      	      	
     	<li> <a href='news_read.jsp?nid=71'><b> 人保部将首次就同工同酬做出规定</b></a> </li>      	
       
      	      	
     	<li> <a href='news_read.jsp?nid=73'><b> 国台办介绍大陆高校加大对台招生力度情况</b></a> </li>      	
       
      	      	
     	<li> <a href='news_read.jsp?nid=77'><b> “持械抢劫，当场击毙” 浙江永康现超雷人标语</b></a> </li>      	
      	
      </ul>
    </div>
    <h1> <img src="images/title_2.gif" alt="国际新闻" /> </h1>
    <div class="side_list">
      <ul>      
       
     		<li> <a href='news_read.jsp?nid=58'><b> 黎巴嫩以色列再次交火互射炮弹</b></a> </li>
       
     		<li> <a href='news_read.jsp?nid=59'><b> 伊朗将于30日前就核燃料供应方案作出答复</b></a> </li>
       
     		<li> <a href='news_read.jsp?nid=60'><b> 与基地有关组织宣称对巴格达连环爆炸负责</b></a> </li>
       
     		<li> <a href='news_read.jsp?nid=61'><b> 8名美军士兵在阿富汗遭路边炸弹袭击身亡</b></a> </li>
       
     		<li> <a href='news_read.jsp?nid=68'><b> 埃及交通部长因致18死火车相撞事故辞职</b></a> </li>
       
     		<li> <a href='news_read.jsp?nid=69'><b> 美国一名外交官辞职抗议美对阿富汗政策</b></a> </li>
      	
      </ul>
    </div>
    <h1> <img src="images/title_3.gif" alt="娱乐新闻" /> </h1>
    <div class="side_list">
      <ul>
             	
     		<li> <a href='news_read.jsp?nid=58'><b> 黎巴嫩以色列再次交火互射炮弹</b></a> </li>
             	
     		<li> <a href='news_read.jsp?nid=59'><b> 伊朗将于30日前就核燃料供应方案作出答复</b></a> </li>
             	
     		<li> <a href='news_read.jsp?nid=60'><b> 与基地有关组织宣称对巴格达连环爆炸负责</b></a> </li>
             	
     		<li> <a href='news_read.jsp?nid=61'><b> 8名美军士兵在阿富汗遭路边炸弹袭击身亡</b></a> </li>
             	
     		<li> <a href='news_read.jsp?nid=68'><b> 埃及交通部长因致18死火车相撞事故辞职</b></a> </li>
             	
     		<li> <a href='news_read.jsp?nid=69'><b> 美国一名外交官辞职抗议美对阿富汗政策</b></a> </li>
      	
      </ul>
    </div>
  </div>


  <div class="main">
    <div class="class_type"> <img src="images/class_type.gif" alt="新闻中心" /> </div>
    <div class="content">
      <ul class="classlist">
        <table width="80%" align="center">
          <tr width="100%">
            <td colspan="2" align="center"><%
           request.setCharacterEncoding("utf-8");
            
            int nid=Integer.parseInt(request.getParameter("nid"));
            MySqlNewsDaoImpl dao=new MySqlNewsDaoImpl();
            String opr=request.getParameter("opr");
            
            if(opr!=null&&opr.equals("addComment")){
            String cauthor=request.getParameter("cauthor");
            String cip=request.getParameter("cip");
            String ccontent=request.getParameter("ccontent");
            Date  cdate= new Date();
            Comment cc=new Comment();
            cc.setCnid(nid);
            cc.setCauthor(cauthor);
            cc.setCip(cip);
            cc.setCdate(cdate);
            cc.setCcontent(ccontent);
            int i=dao.addComment(nid, cc);
            
            }
            
            News nn=dao.EachNews(nid);
             %><%=nn.getNtitle() %></td>
          </tr>
          <tr>
            <td colspan="2"><hr />
            </td>
          </tr>
          <tr>
            <td align="center">作者：<%=nn.getNauthor() %>                                             &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
             </a></td>
            <td align="left">发布时间<%=nn.getNcreateDate() %></td>
          </tr>          
          <tr>
            <td colspan="2" align="center"></td>
          </tr>
          <tr>
            <td colspan="2" >   
            <%=nn.getNcontent() %>
            </td>
          </tr>
          <tr>
            <td colspan="2" >   
            <img src="<%=nn.getNpicPath()%>"/>
            </td>
          </tr>
          <tr>
            <td colspan="2"><hr />
            </td>
          </tr>
        </table>
      </ul>
      <ul class="classlist">
        <div width="100%" align="left" >
            <%
            List<Comment> newsList =dao.ShowComment(nid);
            if(newsList.size()<1){
        
             %>
        	<p style="font-size:20px;color:green;"> 暂无评论！ </p>
        	<%}else{
        	 for(Comment cc:newsList){
        	 %>
	          <p style="font-size:20px;color:green;">
	            <%=cc.getCcontent() %><br>
	            
	          <%=cc.getCauthor() %>-------<%=cc.getCdate() %></p>
	         
	          <hr>
              
                <%
                }
                } %>
          
        </div>
      </ul>
      <ul class="classlist">
      
        <form action="news_read.jsp?opr=addComment&nid=<%=nid%>" method="post" onSubmit="return checkComment()">
          
          <table width="80%" align="center">
            <tr>
              <td> 评 论 </td>
            </tr>
            <tr>
              <td> 用户名： </td>
              <td>
              	 
	            
	              <input id="cauthor" name="cauthor" value="这家伙很懒什么也没留下"/>
	            
                IP：
                <input name="cip" id="cip" value="127.0.0.1" readonly="readonly" style="border:0px;"/>
              </td>
            </tr>
            <tr>
              <td colspan="2"><textarea name="ccontent" id="ccontent" cols="70" rows="10"></textarea>
              </td>
            </tr>
            <td><input name="submit" value="发  表" type="submit"/>
              </td>
          </table>
        </form>
      </ul>
    </div>
  </div>
</div>

<div id="friend">
  <h1 class="friend_t"> <img src="images/friend_ico.gif" alt="合作伙伴" /> </h1>
  <div class="friend_list">
    <ul>
      <li> <a href="#">百度</a> </li>
      <li> <a href="#">谷歌</a> </li>
      <li> <a href="#">新浪</a> </li>
      <li> <a href="#">网易</a> </li>
      <li> <a href="#">搜狐</a> </li>
      <li> <a href="#">人人</a> </li>
      <li> <a href="#">中国政府网</a> </li>
      <li> <a href="index.jsp" style="font-size:20px;color:red;">新闻中心首页</a> </li>
    </ul>
    
  </div>
</div>
<div id="footer">
  <p class=""> 24小时客户服务热线：010-68988888 &#160;&#160;&#160;&#160; <a href="#">常见问题解答</a> &#160;&#160;&#160;&#160; 新闻热线：010-627488888 <br />
    文明办网文明上网举报电话：010-627488888 &#160;&#160;&#160;&#160; 举报邮箱： <a href="#">jubao@jb-aptech.com.cn</a> </p>
  <p class="copyright"> Copyright &copy; 1999-2009 News China gov, All Right Reserver <br />
    新闻中国 版权所有 </p>
</div>

  </body>
</html>
